package com.efounder.util;

import java.io.File;

import android.os.Environment;

import com.efounder.frame.utils.EFConstants;

public class MediaEnvironment {
	
	//路径
	public static final String AUDIO_DIR = "/ESP/Audio";
	public static final String PHOTO_DIR = "/ESP/Photo";
	public static final String VIDEO_DIR = "/ESP/Video";

	//后缀名
	public static final String AUDIO_EXT = ".amr";
	public static final String PHOTO_EXT = ".png";
	public static final String VIDEO_EXT = ".mp4";

	//返回值的标志
	public static final int AUDIO_CODE = 812;
	public static final int PHOTO_CODE = 902;
	public static final int VIDEO_CODE = 429;
	
	public static final String MEDIA_TYPE = "video/*";
	public static final String PHOTO_TYPE = "image/*";

	/**
	 * 录音路径
	 * @return
	 */
	public static File getAudioDir(){
		File file = new File(EFConstants.EXTERNAL_ROOT + AUDIO_DIR);
		if(!file.exists()){
			file.mkdirs();
		}
		return file;
	}

	/**
	 * 照相路径
	 * @return
	 */
	public static File getPhotoDir(){
		File file = new File(EFConstants.EXTERNAL_ROOT + PHOTO_DIR);
		if(!file.exists()){
			file.mkdirs();
		}
		return file;
	}

	/**
	 * 录像路径
	 * @return
	 */
	public static File getVideoDir(){
		File file = new File(EFConstants.EXTERNAL_ROOT + VIDEO_DIR);
		if(!file.exists()){
			file.mkdirs();
		}
		return file;
	}
	
	/**
	 * 是否有SD卡
	 * @return
	 */
	public static boolean haveSdCard() {
		return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
	}
}
